// service/QueryResult.java
package service.User;

public class QueryResult<T> {
    public enum Status {
        SUCCESS, ERROR
    }

    private final Status status;
    private final T data;
    private final String errorMessage;

    private QueryResult(Status status, T data, String errorMessage) {
        this.status = status;
        this.data = data;
        this.errorMessage = errorMessage;
    }

    public static <T> QueryResult<T> success(T data) {
        return new QueryResult<>(Status.SUCCESS, data, null);
    }

    public static <T> QueryResult<T> error(String message) {
        return new QueryResult<>(Status.ERROR, null, message);
    }

    // Getters
    public Status getStatus() { return status; }
    public T getData() { return data; }
    public String getErrorMessage() { return errorMessage; }

}
